/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.velocityme.enums;

import java.util.Arrays;
import java.util.Comparator;
import org.apache.commons.lang.WordUtils;

/**
 *
 * @author rcrida
 */
public enum Permission {
    NODE_CREATE,
    NODE_EDIT,
    NODE_DELETE,
    NODE_POST_COMMENT,
    TASK_CHANGE_STATE,
    ACTION_CREATE,
    ACTION_EDIT,
    PROJECT_CREATE,
    PROJECT_EDIT,
    ISSUE_CREATE,
    ISSUE_EDIT,
    NOTE_CREATE,
    NOTE_EDIT,
    DEPARTMENT_CREATE,
    DEPARTMENT_EDIT,
    ORGANISATION_CREATE,
    ORGANISATION_EDIT,
    PERSON_CREATE,
    PERSON_EDIT,
    USER_CREATE,
    USER_EDIT,
    USER_CHANGE_PASSWORD,
    GROUP_CREATE,
    GROUP_EDIT,
    CONTACT_DETAIL_TYPE_EDIT,
    TASK_TYPE_CREATE,
    TASK_TYPE_EDIT,
    STATE_CREATE,
    STATE_EDIT,
    STATUS_CREATE,
    STATUS_EDIT,
    ROLE_CREATE,
    ROLE_EDIT,
    USER_ACCESS_CREATE,
    USER_ACCESS_DELETE,
    GROUP_ACCESS_CREATE,
    GROUP_ACCESS_DELETE,
    TIME_CREATE,
    TIME_EDIT,
    TIME_DELETE,
    USER_ENABLE,
    NODE_VIEW,
    SYSTEM_PROPERTY_EDIT,
    ANCHOR_CREATE,
    ANCHOR_EDIT,
    TASK_REASSIGN_RESPONSIBILITY,
    TASK_EDIT_DEPENDENCY,
    SPRINT_CREATE,
    SPRINT_EDIT;

    public static Permission[] sortedValues() {
        Permission[] permissions = values();
        Arrays.sort(permissions, new Comparator<Permission>() {

            public int compare(Permission o1, Permission o2) {
                return o1.toString().compareTo(o2.toString());
            }

        });
        return permissions;
    }

    @Override
    public String toString() {
        return WordUtils.capitalizeFully(super.toString().replace('_', ' '));
    }

}
